﻿Imports System.Transactions
Imports CondorTravel.BE
Imports CondorTravel.DALC


Public Class PaquetesBC

    Public Function ListaPaqueteBusqueda(ByVal objPaqueteBE As PaquetesBE) As List(Of PaquetesBE)

        Dim objPaqueteList As List(Of PaquetesBE) = Nothing
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        objPaqueteList = New List(Of PaquetesBE)()
        objPaqueteList = objPaqueteDALC.ListaPaqueteBusqueda(objPaqueteBE)

        Return objPaqueteList
    End Function

    Public Function InsertarPaquete(ByVal objPaqueteBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String, ByRef sCodigo As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objPaqueteDALC As PaqueteDALC = Nothing
                objPaqueteDALC = New PaqueteDALC

                objPaqueteDALC.InsertarPaquete(objPaqueteBE, bExito, sMensaje, sCodigo)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function InsertarPaqueteDet(ByVal objPaqueteDetBE As DetallePaqueteBE, ByRef bExito As Boolean, ByRef sMensaje As String, ByRef sCodigo As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objPaqueteDALC As PaqueteDALC = Nothing
                objPaqueteDALC = New PaqueteDALC

                objPaqueteDALC.InsertarPaqueteDetalle(objPaqueteDetBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function


    Public Function ListaDtsPaquete(ByVal objPaqueteBE As PaquetesBE) As DataSet
        Dim dts As New DataSet
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        dts = objPaqueteDALC.ListaDtsPaquete(objPaqueteBE)

        Return dts
    End Function


    Public Function ListaPaquete(ByVal objPaqueteBE As PaquetesBE) As List(Of PaquetesBE)

        Dim objPaquete As List(Of PaquetesBE) = Nothing
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        objPaquete = New List(Of PaquetesBE)()
        objPaquete = objPaqueteDALC.ListaPaquete(objPaqueteBE)

        Return objPaquete
    End Function

    Public Function ListaPaqueteBusq(ByVal objPaqueteBE As PaquetesBE) As List(Of PaquetesBE)

        Dim objPaquete As List(Of PaquetesBE) = Nothing
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        objPaquete = New List(Of PaquetesBE)()
        objPaquete = objPaqueteDALC.ListaPaqueteBusq(objPaqueteBE)

        Return objPaquete
    End Function

    Public Function EliminarPaquete(ByVal objPaqueteBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objPaqueteDALC As PaqueteDALC = Nothing
                objPaqueteDALC = New PaqueteDALC

                objPaqueteDALC.EliminarPaquete(objPaqueteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function ListarPaquete_Update(ByVal objPaqueteParBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of PaquetesBE)

        Dim objPaquete As List(Of PaquetesBE) = Nothing
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        objPaquete = New List(Of PaquetesBE)()
        objPaquete = objPaqueteDALC.ListaPaquete_Update(objPaqueteParBE, bExito, sMensaje)

        Return objPaquete
    End Function

    Public Function ListaDetallePaquete_Update(ByVal objPaqueteParBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of DetallePaqueteBE)

        Dim objDetPaquete As List(Of DetallePaqueteBE) = Nothing
        Dim objPaqueteDALC As PaqueteDALC = Nothing

        objPaqueteDALC = New PaqueteDALC
        objDetPaquete = New List(Of DetallePaqueteBE)()
        objDetPaquete = objPaqueteDALC.ListaDetallePaquete_Update(objPaqueteParBE, bExito, sMensaje)

        Return objDetPaquete
    End Function

    Public Function ModificaPaquete(ByVal objPaqueteBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objPaqueDALC As PaqueteDALC = Nothing
                objPaqueDALC = New PaqueteDALC

                objPaqueDALC.ModificaPaquete(objPaqueteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function EliminarDetallePaquete(ByVal objPaqueteBE As PaquetesBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objPaqueteDALC As PaqueteDALC = Nothing
                objPaqueteDALC = New PaqueteDALC

                objPaqueteDALC.EliminarDetallePaquete(objPaqueteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function
End Class
